Fix SOAP authentication: reinitialize user in SOAP context#11213
Fix SOAP authentication: reinitialize user in SOAP context#11213sKarki999 wants to merge 2 commits intoILIAS-eLearning:release_11from
Conversation
|
Hi Sagun, I am sceptical if this change is correct. If If the ...
$new_session_id = ilSession::_duplicate($session_id);
...
if ($soap_client->init()) {
ilLoggerFactory::getLogger('obj')->info('Calling soap clone method');
$res = $soap_client->call('ilClone', [$new_session_id . '::' . $client_id, $copy_id]);
} else {
ilLoggerFactory::getLogger('obj')->warning('SOAP clone call failed. Calling clone method manually');
$wizard_options->disableSOAP();
$wizard_options->read();
$res = ilSoapFunctions::ilClone($new_session_id . '::' . $client_id, $copy_id); // <------------------------------
}
...If we now stop re-initializing ILIAS and re-setting the PHP session for this fallback context (the If the ILIAS SOAP server has been called via the So if this PR here gets merged, https://mantis.ilias.de/view.php?id=43882 will occur again. Best regards, |
|
Hi @mjansenDatabay , Thank you for the explanation in detail. What i understood is we need to re-initialize the User context. Calling reInitUser() after initIlias() seem to fix the issue: either directly in ilClone() or inside initIlias() itself. In components/ILIAS/soap/classes/class.ilSoapUtils.php: public function ilClone(string $sid, int $copy_identifier) But does this mean, for every soap functions we might have to call reInitUser after calling initILIAS (although i can see 4-5 places in class.ilSoapUtils.php). Or maybe call once inside initILIAS in SoapAdministration so change in only one place. Please correct me if my analysis here is off the track. Kind regards, |
|
Hi Sagun,
Yes, because recursive calls in the copy/clone process should lead to new SOAP HTTP requests (resulting in a new PHP process with new initialization etc.).
Yes, if the SOAP client cannot be initialized (for instance, due to network issues in the server environment), ILIAS calls Option 1) Maybe you could try this in ...
ilInitialisation::reInitUser();
if (ilContext::getType() !== ilContext::CONTEXT_SOAP) {
ilUtil::setCookie(session_name(), $sid);
}
...This central approach re-initializes the user in every execution context but only sends the HTTP cookie in case Option 2) I guess(!) the issue with ILIAS 11 occurs because we now have to invoke the ...
ilContext::init(ilContext::CONTEXT_SOAP);
entry_point('ILIAS Legacy Initialisation Adapter');
...The context should always be set before(!) we initialize ILIAS. Maybe this does the trick. Maybe we need a combination of Option 2 and Option 1. We should avoid applying changes to all SOAP service methods by introducing Best regards, |
|
Hi @mjansenDatabay , Thank you for the feedback :) Yes, in my opinion we need combination of both although option 1 itself seem to already fix the issue but like you mentioned, the context should always be set before we initialize ILIAS. I could see the same design in other places too. For example: ILIAS/components/ILIAS/WebDAV/resources/webdav.php. Thank you once again. :) Kind regards, |
…initialize user in initAuth
|
Hi @GitHamo , Do you agree with the changes ? Solution is in place. I have tested as well. Can you please provide your feedback ? kind regards, |
Hi Sagun, I agree with the changes, but please check if the Best regards, |
|
Hi again @mjansenDatabay , Thank you for suggestion. If @GitHamo also agrees with previous changes and this as well, i will then move ahead with merging and creating PR for trunk as well. Thank u once again :) kind regards, |
I agree! |
|
Argh |
This PR fixes the issue mentioned here: https://mantis.ilias.de/view.php?id=46273